<h1>Setup a Creative</h1>

<p>Add Creative below</p>

<form action="/setup_creative/view_creative" method="POST">


    <h2>Add New Creative</h2>
    <label>Name of Creative
        <input type="text" name="creative_name" id="creative_name" />
    </label>
    <br>
    <br>

    <div id="modify_tags" style="background-color: #FFFFCC; padding-left:8px; width: 500px;">
        <?
        echo 'Add category';

        $category_form_input = array(
                'name'        => 'new_category_name',
                'id'          => 'new_category_name',
                'value'       => '',
        );

        echo form_input($category_form_input);
        $js = 'onClick="add_category(document.getElementById(\'new_category_name\').value)"';
        echo form_button('new_category_button','Add Category',$js);

        echo '<br>Add tag';
        echo form_input('new_tag_name', '', 'id="new_tag_name"') . ' to category ';

        echo '<div id="cat_dropdown_div" style="display:inline-block">';
        $append = 'id="selected_category"';
        echo form_dropdown('categories', $categories, '0',$append);
        echo '</div>';

        $js = 'onClick="add_tag(document.getElementById(\'new_tag_name\').value , document.getElementById(\'selected_category\').value)"';
        echo form_button('new_tag_button','Add Tag',$js);

        ?>
    </div>

    <h2>Associate Creative with Tags</h2>

    <div id="tags_div">



        <?php
        foreach($tags as $category => $tag_array)
        {
            echo "<h3>" . $category . "</h3>";

            for($i=0;$i<count($tag_array);$i++)
            {
                $tag_values = explode('|', $tag_array[$i]);
                $tag_id = $tag_values[0];
                $tag_name = $tag_values[1];

                $data = array(
                        'name'        => 'tags[]',
                        'id'          => 'tags_checkbox',
                        'value'       => $tag_id,
                        'checked'     => FALSE,
                        'style'       => 'margin:10px',
                );

                echo form_checkbox($data);
                echo '<label>' . $tag_name . '</label><br />';
            }
        }

        ?>
    </div>


    <?php
    echo '<br>';
    echo form_submit('generate_button','Generate Script');

    ?>

</form>



<!-- CI mode -->
